Since we stored what the user entered in a variable, we can use that variable to display the user's answer in our story.
Go to . Drag Set Text into the bottom of your code. Change the name in front to text.
Change the string inside the parentheses to the variable transition1. Be sure to DELETE the quotation marks!
The .set_text() command will replace what we have in the current text box.
To navigate the page using the TAB key, first press ESC to exit the code editor.
stage.set_background("park")
sprite = codesters.Sprite("person3")
sprite.glide_to(-100, 50)
# text = codesters.Text("text", x, y, "color")
text = codesters.Text("I went to the park!", 0, -200, "blue")
stage.wait(1)
sprite.move_right(400)
transition1 = sprite.ask("Choose a transition from the sequence category.")
t = codesters.Teacher()
try:
tval1 = t.find_function('set_text')[0][1]
except:
tval1 = "DNE"
t1 = TestObjective()
t1.add_success('transition1' in tval1 and '"transition1"' not in tval1 and 'text' in tval1 and 'sprite' not in tval1, "Great job!")
t1.add_failure(tval1 == "DNE", "Did you add a Set Text command?")
t1.add_failure('sprite' in tval1, "Did you change the name in front of the .set_text() command?")
t1.add_failure('transition1' not in tval1, "Did you change the string in your set_text command to the variable transition1?")
t1.add_failure('"transition1"' in tval1, "Oops! Make sure you're using the variable transition1. Remove the quotes!")
tester = TestManager()
tester.add_test_list([t1])
tester.run_tests()
tester.display_first_feedback()
Are you already running a Codesters project in another tab or window?
Micro:bit can only connect to one web page at a time.
Try stopping other Codesters projects or closing
other tabs or windows that may be using your Micro:bit.
If that doesn't fix the problem try disconnecting your Micro:bit,
reloading this page, and reconnecting your Micro:bit.